package cz.tomasdvorak.cars.wicket.resources;

import org.apache.wicket.markup.html.DynamicWebResource;
import org.apache.wicket.util.time.Time;

public class ImageResourceState extends DynamicWebResource.ResourceState {

    private String contentType;
    private byte[] data;
    private Time lastModified;

    public ImageResourceState(Time lastModified) {
        super();
        this.lastModified = lastModified;
    }

    public ImageResourceState(String contentType, byte[] data, Time lastModified) {
        this.contentType = contentType;
        this.data = data;
        this.lastModified = lastModified;
    }

    @Override
    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    @Override
    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    @Override
    public int getLength() {
        return data.length;
    }


    @Override
    public Time lastModifiedTime() {
        return lastModified;
    }
}